﻿//Copyright (C) <2013> <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System.Collections.Generic;
using System.Windows.Controls;
using FinPlusInterfaces;

namespace FinPlusCompView
{
    public partial class FinPlusDockPanel : FinPlusControl
    {
        [State(Test = true)]
        public override bool IsValid { get; set; }
        [State(Test = true)]
        public override string TestString { get { return Adapter.ToString(); } }
        [State(Save = true)]
        public new double Height { get { return base.Height; } set { base.Height = value; } }
        [State(Save = true)]
        public new double Width { get { return base.Width; } set { base.Width = value; } }
        [State(Test = true)]
        public int ChildrenCount { get {return dockPanel.Children.Count; } }
        public override IPods Adapter { get { return base.Children(dockPanel.Children); } }

        //construct
        public FinPlusDockPanel(IDictionary<string, IFinPlusComp[]> controls)
        {
            InitializeComponent();

            foreach (var dock in controls)
                foreach (var control in dock.Value)
                    if(control.GetType().Equals(typeof(FinPlusStatusBar)))
                        statusBar.Children.Add(DockSet((UserControl)control, dock.Key));
                    else
                        dockPanel.Children.Add(DockSet((UserControl)control, dock.Key)); 

            IsValid = true;
        }

        //common control interface
        public override void Dock(object control, string dock) { dockPanel.Children.Add(DockSet((UserControl)control, dock)); }
     }
}

